package com.xzh.mallorderapi.service;


import com.mall.common.util.JsonResult;
import com.mall.model.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@FeignClient(value="mall-gateway",contextId = "order-product-api")
public interface ProductServiceClient {
    @PostMapping("/api/products/{id}/{jianshaostock}")
    JsonResult<Boolean> deductStock(@PathVariable("id") Long productId,
                                    @PathVariable("jianshaostock") Integer count);

    @PostMapping("/api/products/rollback/{id}/{zengjiastock}")
    JsonResult<Boolean> restoreStock(@PathVariable("id") Long productId,
                                      @PathVariable("zengjiastock") Integer count);

    @GetMapping("/api/products/{id}")
    ResponseEntity<JsonResult<Product>> findById(@PathVariable("id") Long productId);

    @PutMapping("/api/products/upte")
    ResponseEntity<JsonResult<?>> update(@RequestBody Product product);
}
